<?php

$lang_from_to = str_replace("<#1>", "1.1.6", $lang_update['update_from_to']);
$lang_from_to = str_replace("<#2>", "1.7.2", $lang_from_to);

if($_GET['step']=="2"){
	mysql_query("UPDATE {$db_prefix}settings SET max_version='$ver_name'");
	
	mysql_query("CREATE TABLE `{$db_prefix}gallery_images_ratings` (
	`image` int(10) unsigned NOT NULL,
	`total_votes` int(10) unsigned NOT NULL,
	`total_value` int(10) unsigned NOT NULL,
	`users` longtext,
	PRIMARY KEY  (`image`)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;");

	mysql_query("CREATE TABLE `{$db_prefix}gallery_settings` (
	`t_max_height` smallint(4) unsigned NOT NULL default '180',
	`t_max_width` smallint(4) unsigned NOT NULL default '180',
	`image_max_size` int(10) unsigned NOT NULL,
	`image_extensions` varchar(100) NOT NULL,
	`image_reflections` tinyint(1) unsigned NOT NULL default '0',
	`image_perpage` tinyint(2) unsigned NOT NULL default '20'
	) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;");
	
	mysql_query("INSERT INTO `{$db_prefix}gallery_settings` (`t_max_height`, `t_max_width`, `image_max_size`, `image_extensions`, `image_reflections`, `image_perpage`) VALUES (180, 180, 400000, 'gif,jpg,jpeg,png', 1, 20);");
		
	$array_table = array(
		"Gallery_images_ratings ".$lang_update['upd_done']."",
		"Gallery_settings ".$lang_update['upd_done']."",
		"Settings ".$lang_update['upd_done']."",
		"Nations ".$lang_update['upd_done']."",
		"Polls ".$lang_update['upd_done']."",
		"Moderators ".$lang_update['upd_done'].""
	);
	
	$html_ok = "<form method='post' onsubmit='return check_license()' action='upgrade.php'>";
	$html_ok .= "<br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	$html_ok .= "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	$html_ok .= "</form>";
	
}else{
	echo "<form method='post' onsubmit='return check_license()' action='upgrade.php?step=2'>";
	echo "<br /><br /><br /><br /><div style='font: 16px Arial; font-weight: bold;'>";
	echo "<center>".$lang_from_to."</center></div><br /><br /><br /><br />";
	echo "<input type='hidden' name='ver_name' value='1.7.2'/><div>";
	echo "<center><input type='submit' class='img-submit' value='".$lang['submit_ok']."'/></center>";
	echo "</form>";
}
?>